<!-- 防抖函数 -->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="btn">点我试试呢</button>
    <script>
        const btn = document.getElementById('btn')
        btn.addEventListener('click',FD(handle,1000))
        function FD(handle,wait){
            let timer = null
            return function(){
                clearTimeout(timer)
                timer = setTimeout(()=>{
                    handle()
                },wait)

            }
        }
        function handle(){
            console.log('我通过了兄弟');
        }
    </script>
</body>
</html>